package com.shuwen.gcdj.exception;

import com.shuwen.gcdj.common.api.IErrorCode;
import com.shuwen.gcdj.common.api.ResultCode;

/**
 * 错误码包装
 */
public class IErrorCodeFactory {
    private IErrorCodeFactory() {}

    /**
     * 生产IErrorCode
     *
     * @param code long
     * @param message String
     * @return IErrorCode
     */
    public static IErrorCode create(long code, String message) {
        return new IErrorCodeAdapter(code, message);
    }

    public static IErrorCode createSuccess() {
        return ResultCode.SUCCESS;
    }

    public static IErrorCode createInvalidParam(String message) {
        return new IErrorCodeAdapter(ResultCode.MISSING_PARAMS.getCode(), message);
    }
}
